//
//  ImageWithTitle.m
//  BeautyClother
//
//  Created by dllo on 15/8/26.
//  Copyright (c) 2015年 宋爽. All rights reserved.
//

#import "ImageWithTitle.h"

@interface ImageWithTitle ()
@property (nonatomic, assign) CGFloat offWidth;
@property (nonatomic, assign) CGFloat offHeight;

@end
@implementation ImageWithTitle

- (void)dealloc
{
    [_image release];
    [_title release];
    [_online release];
    [super dealloc];
}

-(instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
        self.offWidth = [[UIScreen mainScreen]bounds].size.width / 375;
        self.offHeight = [[UIScreen mainScreen]bounds].size.height / 667;
        self.image = [[UIImageView alloc]init];
        [self addSubview:self.image];
        [_image release];
        
        self.title = [[UILabel alloc]init];
        [self addSubview:_title];
        [_title release];
        
        self.online = [[UILabel alloc]init];
        [self addSubview:self.online];
        
        [_online release];
        
    }
    return self;
    
}


- (void)layoutSubviews
{
    [super layoutSubviews];
    _image.frame = CGRectMake(5, 0, self.frame.size.width - 10  *_offWidth, 70 * _offHeight);
    _title.frame = CGRectMake(0, 80 * _offHeight, self.frame.size.width, 20 * _offHeight);
    _online.frame = CGRectMake(0, 100 * _offHeight, self.frame.size.width, 20 * _offHeight);
    _title.textAlignment = 1;
    _online.textAlignment = 1;
    _online.font = [UIFont systemFontOfSize:12];
    _online.textColor = [UIColor darkGrayColor];
}



/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
